//
//  SDetailsTableViewCell.m
//  小胖兔旅游指南
//
//  Created by 小胖兔 on 15/4/14.
//  Copyright (c) 2015年 小胖兔. All rights reserved.
//

#import "SDetailsTableViewCell.h"

@implementation SDetailsTableViewCell

- (void)dealloc
{
    [_aImageView release];
    [_aLabel release];
    [_bLabel release];
    [_starRateView release];
    
    [super dealloc];
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        self.aImageView = [[UIImageView alloc] initWithFrame:CGRectMake(5, 5, [[UIScreen mainScreen] bounds].size.width - 10, ([[UIScreen mainScreen] bounds].size.width - 10) / 239.89 * 134.76)];
        [self.aImageView.layer setMasksToBounds:YES];
        [self.aImageView.layer setCornerRadius:12.0];
        [self.contentView addSubview:self.aImageView];
        [self.aImageView release];
        
        UIView *cView = [[UIView alloc] initWithFrame:CGRectMake(self.aImageView.frame.origin.x + self.aImageView.frame.size.width / 5, self.aImageView.frame.origin.y + self.aImageView.frame.size.height / 4, self.aImageView.frame.size.width / 5 * 3, self.aImageView.frame.size.height / 2)];
        [self.contentView addSubview:cView];
        [cView release];
        [cView setBackgroundColor:[UIColor blackColor]];
        [cView setAlpha:0.3];
        [cView.layer setMasksToBounds:YES];
        [cView.layer setCornerRadius:6.0];
        
        self.aLabel = [[UILabel alloc] initWithFrame:CGRectMake(cView.frame.origin.x, cView.frame.origin.y, cView.frame.size.width, cView.frame.size.height / 2)];
        [self.contentView addSubview:self.aLabel];
        [self.aLabel release];
        [self.aLabel setTextAlignment:NSTextAlignmentCenter];
        [self.aLabel setTextColor:[UIColor whiteColor]];
        [self.aLabel setFont:[UIFont fontWithName:@"Helvetica-Bold" size:30]];
        
        self.bLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.aLabel.frame.origin.x, self.aLabel.frame.origin.y + self.aLabel.frame.size.height, self.aLabel.frame.size.width, self.aLabel.frame.size.height)];
        [self.contentView addSubview:self.bLabel];
        [self.bLabel release];
        [self.bLabel setFont:[UIFont systemFontOfSize:16]];
        [self.bLabel setTextColor:[UIColor whiteColor]];
        [self.bLabel setTextAlignment:NSTextAlignmentCenter];
        
        UIView *aView = [[UIView alloc] initWithFrame:CGRectMake(cView.frame.origin.x, cView.frame.origin.y + cView.frame.size.height, cView.frame.size.width, 2)];
        [self.contentView addSubview:aView];
        [aView setBackgroundColor:[UIColor whiteColor]];
        
        
        //  倒入头文件CWStarRateView.h  创建星星
        self.starRateView = [[CWStarRateView alloc] initWithFrame:CGRectMake(aView.frame.origin.x       , aView.frame.origin.y + aView.frame.size.height, aView.frame.size.width, 20) numberOfStars:5];
        // 是否允许不是整星
        self.starRateView.allowIncompleteStar = YES;
        // 是否开启动画
        self.starRateView.hasAnimation = YES;
        // 关闭星星的交互
        [self.starRateView setUserInteractionEnabled:NO];
        [self.contentView addSubview:self.starRateView];
        

    }
    return self;
}


- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {

    // Configure the view for the selected state
    
}

@end
